package itheima.com.socketdemo3;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        DatagramSocket ds = new DatagramSocket();
        while (true) {
//            System.out.println("请输入您要发送的数据");
            String data = sc.next();
            if("886".equals(data)){
                    break;
            }
            byte[] bytes = data.getBytes();
            InetAddress address = InetAddress.getByName("127.0.0.1");
            int port =2000;
            DatagramPacket dp = new DatagramPacket(bytes,bytes.length,address,port);

            ds.send(dp);
        }
        ds.close();
    }
}
